SUBROUTINE reciplat(cell_shape,cell_vol,recip_vol,recip_shape)
! Copyright (C) 2009 W. Wang
! This file is distributed under the terms of the GNU General Public License.
! See the file COPYING for license details.

IMPLICIT NONE
REAL(8),INTENT(IN) :: cell_shape(3,3)
REAL(8),INTENT(OUT) :: recip_shape(3,3),cell_vol,recip_vol
REAL(8),PARAMETER :: PI=3.1415926

!local variables
REAL(8) :: CrossAB
CALL cross_ab(cell_shape(1,:),cell_shape(2,:),CrossAB)
CALL dot_ab(CrossAB,cell_shape(3,:),cell_vol)
recip_vol=2*PI/cell_vol
CALL cross_ab(cell_shape(2,:),cell_shape(3,:),recip_shape(1,:))
CALL cross_ab(cell_shape(3,:),cell_shape(1,:),recip_shape(2,:))
CALL cross_ab(cell_shape(1,:),cell_shape(2,:),recip_shape(3,:))

recip_shape(:,:)=recip_vol*recip_shape(:,:)
RETURN
END SUBROUTINE
